package com.example.util;

import com.example.beans.WorkInfoemation;
import com.example.inter.LoginCallBack;
import com.example.inter.WorkInfo;
import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.HttpHandler;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest;

import java.io.File;

/**
 * Created by Administrator on 2016/3/7.
 */
public class WorkTeacher implements WorkInfo {
    @Override
    public void getInfo(int i ,final LoginCallBack loginCallBack) {
        HttpUtils http = new HttpUtils();
        RequestParams params = new RequestParams();
        params.addQueryStringParameter("p", i+"");
        http.send(HttpRequest.HttpMethod.GET,
                "http://192.168.191.1/app/index.php/work",params,
                new RequestCallBack<String>(){
                    @Override
                    public void onLoading(long total, long current, boolean isUploading) {

                    }

                    @Override
                    public void onSuccess(ResponseInfo<String> responseInfo) {
                        loginCallBack.onSuccess(responseInfo.result.toString());
                    }

                    @Override
                    public void onStart() {
                    }

                    @Override
                    public void onFailure(HttpException error, String msg) {
                    loginCallBack.onFailed();
                    }
                });
    }


}
